/*******************************************************************************
* 
* AudioSprite takes responsibility to play sounds
* 
* 
******************************************************************************/
#pragma once
#include "noria.h"
#include <xaudio2.h>

namespace noria{ namespace xaudio
{
    class AudioSprite
    {
    public:
        AudioSprite(IXAudio2* pXAudio2, cbinary_ref pcm);
        ~AudioSprite(void);
        
        // ------------------------------------------------------------------------------------
        // play the PCM/ADPCM music
        // ------------------------------------------------------------------------------------
        void play(bool async = true);

        // ------------------------------------------------------------------------------------
        // stop playing immediately
        // ------------------------------------------------------------------------------------
        void stop();

    private:
        IXAudio2SourceVoice* m_voice;

        void init(IXAudio2* pXAudio2, cbinary_ref pcm);
    };
}}
